require([
  'jquery',
  'pageInit',
  'dataTableFilter',
  'loading',
], function($, vamakerPage, VamDataTable, VamLoader) {
  $(function() {
    var 
      $dataTable = $('#data-table'),
      dataUrl = VAM.getVar('BRAND_DATA_LIST'),
      dataEidtUrl = VAM.getVar('DATA_EDIT_URL'),
      $reportDataThead = $dataTable.find('thead'),
      $loadingWrap = new VamLoader().loader($('#list-loading-wrap')),
    listTable, tableOptions = {};
    // Table settings.
    tableOptions = {
      'ajax': {
        'url': dataUrl
      },
      'order': [4,'desc'],
      'columns': [
        {'data': 'id'},
        {'data': 'name'},
        {'data': 'largeVocation'},
        {'data': 'mediumVocation'},
        // {'data': 'transformName'},
        // {'data': 'transformBelongMethod'},
        {'data': 'lastModifiedDate'},
        {'data': 'operate'}
      ],
      'columnDefs': [
        {
          'targets': [0,1,2,3,4],
          'render': function (data, type, full, meta) {
            return '<p title="' + data + '">' + data +'</p>'
          }
        },
        {
          'targets': -1,
          'render': function (data, type, full, meta) {
            return '<div class="tab-btn-group">'
                  + '<a href="' + dataEidtUrl + '?id=' + full.id + '" class="btn btn-primary btn-xs tab-edit" data-type="edit" title="' + VAM.j('Edit') + '"><i class="fa fa-edit"></i></a>'
                  + '</div>';
          }
        }
      ],
      'initComplete': function() {
        tableResize = new VamDataTable().columnResize($dataTable);
      }
    };
    $dataTable
    .on('preXhr.dt', function(evt) {
      $loadingWrap.show();
    });
    listTable = new VamDataTable().dataTables($dataTable, tableOptions);
    // After table data list.
    listTable.on('xhr.dt', function(evt) {
      $loadingWrap.fadeOut();
    });
  });
});
